package leecode

func numberOfSteps(num int) int {
	var result int
	var temp func(num int)
	temp = func(num int) {
		//确定递归终止条件
		if num == 0 {
			return
		}
		result++
		if num%2 == 0 {
			num = num / 2
		} else {
			num -= 1
		}
		temp(num)
	}
	temp(num)
	return result
}
